Skip to content

make bundle script write in ordered chunks - #75

Merged
CodeTriangle merged 2 commits into
masterfrom
bundle-ordered
Jun 10, 2026
Merged

make bundle script write in ordered chunks#75
CodeTriangle merged 2 commits into
masterfrom
bundle-ordered

Conversation

@CodeTriangle

Copy link
Copy Markdown
Owner

fflate passes you data in chunks of a few bytes to a few kilobytes, which you write to your file. On calling outfile.write(data), it initiates a promise to write that data but does not do so yet. If you call outfile.write again while that promise is unresolved, then there is no guarantee that the first promise to be submitted will be the first to be written. It usually will but that can't be guaranteed. The fix is to use createWriteStream to make an ordered write buffer.

@CodeTriangle
CodeTriangle merged commit a7bd7a4 into master Jun 10, 2026
@CodeTriangle
CodeTriangle deleted the bundle-ordered branch June 15, 2026 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant